{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Sample Notebook\n",
    "The output of this notebook will be executed via PySpark job then will be stored in the specified notebook path in notebook_args in the Composer DAGs. \n",
    "This notebook let users \n",
    "* verify if GCS buckets are properly mounted as a file system and\n",
    "* execute Python files that are stored in mounted GCS buckets by !python and %run commands and\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Filesystem                   Size  Used Avail Use% Mounted on\n",
      "udev                         3.7G     0  3.7G   0% /dev\n",
      "tmpfs                        746M   52M  695M   7% /run\n",
      "/dev/sda1                     30G   13G   16G  47% /\n",
      "tmpfs                        3.7G     0  3.7G   0% /dev/shm\n",
      "tmpfs                        5.0M     0  5.0M   0% /run/lock\n",
      "tmpfs                        3.7G     0  3.7G   0% /sys/fs/cgroup\n",
      "/dev/sda15                   124M  5.9M  118M   5% /boot/efi\n",
      "tmpfs                        746M     0  746M   0% /run/user/107\n",
      "tmpfs                        746M     0  746M   0% /run/user/108\n",
      "tmpfs                        746M     0  746M   0% /run/user/109\n",
      "tmpfs                        746M     0  746M   0% /run/user/111\n",
      "kristin-0105                 1.0P     0  1.0P   0% /path-1\n",
      "notebooks-staging-bucket-kk  1.0P     0  1.0P   0% /path-2\n",
      "tmpfs                        746M     0  746M   0% /run/user/112\n"
     ]
    }
   ],
   "source": [
    "# Verify if buckets have been succesfully mounted as a file system\n",
    "!df -h\n",
    "\n",
    "!pwd \n",
    "!echo $USER"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "python file\n",
      "python file\n"
     ]
    }
   ],
   "source": [
    "# Verify if bucket 1 has been succesfully mounted and can excute .py files in the bucket 1\n",
    "# EDIT:<file path for files in bucket>\n",
    "!ls /path-1 \n",
    "!sudo python /path-1/sample.py\n",
    "%run /path-1/sample.py\n",
    "\n",
    "# Verify if bucket 2 has been succesfully mounted and can excute .py files in the bucket 2 \n",
    "# EDIT:<file path for files in bucket>\n",
    "!ls /path-2 \n",
    "!sudo python /path-2/notebooks/jupyter/sample.py\n",
    "%run /path-2/notebooks/jupyter/sample.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "x=\"execution from the notebook\"\n",
    "print(x)"
   ]
  }
 ],
 "metadata": {
  "application/vnd.databricks.v1+notebook": {
   "dashboards": [],
   "language": "python",
   "notebookMetadata": {
    "pythonIndentUnit": 4
   },
   "notebookName": "databricks_1",
   "notebookOrigID": 4205708762025595,
   "widgets": {}
  },
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.1 (v3.11.1:a7a450f84a, Dec  6 2022, 15:24:06) [Clang 13.0.0 (clang-1300.0.29.30)]"
  },
  "vscode": {
   "interpreter": {
    "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
